package com.zzb.framework.query.postgres;

import com.zzb.framework.query.GenericQueryDAO;
import com.zzb.framework.query.sqlbuilder.PagionageSqlBuilder;
import com.zzb.framework.query.sqlbuilder.postgres.PostgresPagionageSqlBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.core.JdbcTemplate;

/**
 * 基本分页查询dao 使用的是jdbcTemplate 只做显示用，不可以在业务操作时使用该方法，会导致事务问题
 * Created by zhangzhenbin on 2017/1/3.
 */

public class PostgresGenericQueryDAO implements GenericQueryDAO {
    private static final Logger logger = LoggerFactory.getLogger(PostgresGenericQueryDAO.class);
    private JdbcTemplate jdbcTemplate;
    private PagionageSqlBuilder pagionageSqlBuilder = new PostgresPagionageSqlBuilder();

    public PostgresGenericQueryDAO(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }

    @Override
    public Logger getLogger() {
        return logger;
    }

    @Override
    public PagionageSqlBuilder getPagionageSqlBuilder() {
        return pagionageSqlBuilder;
    }

    @Override
    public JdbcTemplate getJdbcTemplate() {
        return jdbcTemplate;
    }
}
